<?php

/**
 * CityBao (C)2010-2099 CityBao Inc.
 * This is NOT a freeware, use is subject to license terms
 *
 * Id: member_user.php 2011-1-4 11:10:01
 */
if (!defined('CITY_BAO') || !defined('CB_ADMIN')) {
    exit('Access Denied');
}
if (!in_array($action, array('add', 'list', 'delete', 'move'))) {
    $action = 'list';
}
if ('list' === $action) {
    require_once CB_INCLUDE . 'datalist.class.php';
    $page = $request->getParam('page');
    $sql = 'SELECT * FROM {#cbdbPrefix}members where 1';
    $datalist = new datalist ();
    $datalist->setQuery($sql);
    $datalist->setCurrentPage($page);
    $group_sql = "SELECT * FROM {#cbdbPrefix}usergroups where 1 order by listorder";
    $group_list_db = $cbdb->get_results($group_sql, ARRAY_A);
    $group_list = array();
    foreach ($group_list_db as $group){
        $group_list[$group['groupid']] = $group['groupname'];
    }
    $tpl->assign('group_list', $group_list);
    $tpl->assign('user_list', $datalist->getData());
    $tpl->assign('pageControl', $datalist->getPages());
    $tpl->display('member/user/list.tpl');
} elseif ('add' === $action) {

} elseif ('delete' === $action) {

} elseif ('move' === $action) {
    print_r($request->getParams());
}